package com.samehope.ar.mapper;

import com.samehope.ar.entity.SysUserCompany;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.CompanyDetailDataVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户公司 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface SysUserCompanyMapper extends BaseMapper<SysUserCompany> {

    /**
     * 根据企业和用户查找关系
     * @param companyId
     * @param userId
     * @return
     */
    SysUserCompany findByCompanyAndUser(@Param("companyId") Long companyId,
                                        @Param("userId") Long userId);

    /**
     * 根据用户查找企业及相关管理员
     * @param userId
     * @return
     */
    List<CompanyDetailDataVO> getCompanyByUser(@Param("userId") Long userId);
}
